<template>
  <div>
    <el-form :model="form">
      <el-form-item label="">
        <el-input v-model="form.key" placeholder="" style="width:200px;" size="small"></el-input>
        <el-button type="primary" size="small" @click="search">搜索</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "Search",
  data(){
    return{
      form:{},
    }
  },
  methods:{
    search(){
      //向父组件userlist传递数据
      //搜索结束获取了一组数据， 现在要传递给父组件
      let data = [{'name':'小张','age':18},{'name':'老田','age':19},]
      this.$emit('getData',data) //getDate 与父组件中@getData="handerData" 中名称一致
    }
  },
}
</script>

<style scoped>
.el-form{
  width:300px;
  float: right;
}

</style>
